<?php
namespace App\Traits;

use GatewayWorker\Lib\Gateway;

trait WorkerRequest
{
    protected static $request = [];//发送的数据

    protected static $client_id; //客户访问client_id

    protected static function bindUid($uid = 0)
    {
        if(self::$client_id && $uid) {
            Gateway::bindUid(self::$client_id, $uid);//client_id绑定uid
        }
    }

    protected static function bindUserData($userData = [])
    {
        if(self::$client_id && $userData) {
            Gateway::setSession(self::$client_id, $userData);//根据client_id设置用户数据
        }
    }
}
